<?php

/**
 * demo_data类
 *保健茶
红茶
茶具
金骏眉
正山小种
花茶
大红袍
铁观音
 * @since 1.0 <2015-10-24> SoChishun <14507247@qq.com> Added.
 */
$data = array(
    array('title' => '首页', 'type_id' => 4),
    array('title' => '茶百科', 'type_id' => 2),
    array('title' => '茶之道', 'type_id' => 2),
    array('title' => '茶之源', 'type_id' => 2),
    array('title' => '茶与健康', 'type_id' => 2),
    array('title' => '茶与文化', 'type_id' => 2),
    array('title' => '茶叶知识', 'type_id' => 2),
    array('title' => '关于我们', 'type_id' => 2, 'children' => array(
            array('title' => '公司简介', 'type_id' => 2, 'children' => array(
                    array('title' => '公司荣誉', 'type_id' => 1),
                    array('title' => '关于我们', 'type_id' => 1),
                    array('title' => '企业文化', 'type_id' => 1),
                    array('title' => '感受鑫优', 'type_id' => 1),
                    array('title' => '组织架构', 'type_id' => 1),
                    array('title' => '企业资质', 'type_id' => 1),
                )),
            array('title' => '联系我们', 'type_id' => 1),
            array('title' => '招贤纳士', 'type_id' => 1),
        )),
    array('title' => '新手指南', 'type_id' => 2, 'children' => array(
            array('title' => '购买须知', 'type_id' => 1),
            array('title' => '积分说明', 'type_id' => 1),
            array('title' => '发票制度', 'type_id' => 1),
            array('title' => '服务承诺', 'type_id' => 1),
        )),
    array('title' => '关于我们', 'type_id' => 2, 'children' => array(
            array('title' => '公司简介', 'type_id' => 1),
            array('title' => '董事会寄语', 'type_id' => 1),
            array('title' => '企业文化', 'type_id' => 1),
            array('title' => '荣誉资质', 'type_id' => 1),
            array('title' => '组织架构', 'type_id' => 1),
            array('title' => '环境展示', 'type_id' => 1),
            array('title' => '经验团队', 'type_id' => 1),
            array('title' => '分析师介绍', 'type_id' => 1),
            array('title' => '联系我们', 'type_id' => 1),
        )
    ),
    array('title' => '售后服务', 'type_id' => 2, 'children' => array(
            array('title' => '退换货原则', 'type_id' => 1),
            array('title' => '延保服务', 'type_id' => 1),
            array('title' => '退换货地址', 'type_id' => 1),
            array('title' => '如何办理提现', 'type_id' => 1),
        )),
    array('title' => '物流配送', 'type_id' => 2, 'children' => array(
            array('title' => '配送范围及时间', 'type_id' => 1),
            array('title' => '加急快递', 'type_id' => 1),
            array('title' => '商品验货与签收', 'type_id' => 1),
            array('title' => '订单查询', 'type_id' => 1),
        )),
    array('title' => '假一赔十', 'type_id' => 2, 'children' => array(
            array('title' => '假一赔十', 'type_id' => 1),
            array('title' => '防伪标签', 'type_id' => 1),
            array('title' => '公司资质', 'type_id' => 1),
            array('title' => '防伪查询', 'type_id' => 1),
        )),
);

$i = 0;

function echoxx($data, $pid = 0) {
    global $i;
    foreach ($data as $row) {
        $fields = array();
        $values = array();
        foreach ($row as $key => $value) {
            if ('children' == $key) {
                continue;
            }
            $fields[] = $key;
            $values[] = $value;
        }
        $i++;
        echo 'insert into t_porg_document_category (id,pid,' . implode(',', $fields) . ') values (' . $i . ',' . $pid . ',\'' . implode("','", $values) . '\');<br />';
        if (!empty($row['children'])) {
            echoxx($row['children'], $i);
        }
    }
}

echoxx($data);
echo 'update t_porg_document_category set status=1;';
